<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>My Project: M:/移动硬盘/曹健/DX3D完成作业/619/D3DX封装/src/Singleton.h 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">My Project
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.9.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="pages.html"><span>相关页面</span></a></li>
      <li><a href="annotated.html"><span>类</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>文件列表</span></a></li>
      <li><a href="globals.html"><span>文件成员</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">Singleton.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_singleton_8h.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00003"></a><span class="lineno"><a class="line" href="class_singleton.html">    3</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_singleton.html">Singleton</a></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;{</div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l00006"></a><span class="lineno"><a class="line" href="class_singleton.html#a923b995920da9c06590adb170ab2f890">    6</a></span>&#160;    <a class="code" href="class_singleton.html#a923b995920da9c06590adb170ab2f890">Singleton</a>() {}</div>
<div class="line"><a name="l00007"></a><span class="lineno"><a class="line" href="class_singleton.html#ac6e7af82cba33f561bd64e5e0243e7f8">    7</a></span>&#160;    <a class="code" href="class_singleton.html#ac6e7af82cba33f561bd64e5e0243e7f8">~Singleton</a>() {}</div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00009"></a><span class="lineno"><a class="line" href="class_singleton.html#a42d71ed5fbcf57e1b1d6c268988c00c3">    9</a></span>&#160;    <span class="keyword">static</span> T* <a class="code" href="class_singleton.html#a42d71ed5fbcf57e1b1d6c268988c00c3">singlenPtr</a>;</div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00013"></a><span class="lineno"><a class="line" href="class_singleton.html#ac133f0a804e1f184d1699d2e2fbcd2d5">   13</a></span>&#160;    <span class="keyword">static</span> T* <a class="code" href="class_singleton.html#ac133f0a804e1f184d1699d2e2fbcd2d5">GetsinglenPtr</a>()</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;    {</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;        <span class="keywordflow">if</span> (!singlenPtr)</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;            singlenPtr = <span class="keyword">new</span> T;</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_singleton.html#a42d71ed5fbcf57e1b1d6c268988c00c3">singlenPtr</a>;</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;    }</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;};</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">typename</span> T&gt;</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;T*<a class="code" href="class_singleton.html">Singleton&lt;T&gt;::singlenPtr</a> = <span class="keyword">nullptr</span>;</div>
<div class="ttc" id="class_singleton_html"><div class="ttname"><a href="class_singleton.html">Singleton</a></div><div class="ttdef"><b>Definition:</b> Singleton.h:3</div></div>
<div class="ttc" id="class_singleton_html_a42d71ed5fbcf57e1b1d6c268988c00c3"><div class="ttname"><a href="class_singleton.html#a42d71ed5fbcf57e1b1d6c268988c00c3">Singleton::singlenPtr</a></div><div class="ttdeci">static T * singlenPtr</div><div class="ttdef"><b>Definition:</b> Singleton.h:9</div></div>
<div class="ttc" id="class_singleton_html_ac6e7af82cba33f561bd64e5e0243e7f8"><div class="ttname"><a href="class_singleton.html#ac6e7af82cba33f561bd64e5e0243e7f8">Singleton::~Singleton</a></div><div class="ttdeci">~Singleton()</div><div class="ttdef"><b>Definition:</b> Singleton.h:7</div></div>
<div class="ttc" id="class_singleton_html_a923b995920da9c06590adb170ab2f890"><div class="ttname"><a href="class_singleton.html#a923b995920da9c06590adb170ab2f890">Singleton::Singleton</a></div><div class="ttdeci">Singleton()</div><div class="ttdef"><b>Definition:</b> Singleton.h:6</div></div>
<div class="ttc" id="class_singleton_html_ac133f0a804e1f184d1699d2e2fbcd2d5"><div class="ttname"><a href="class_singleton.html#ac133f0a804e1f184d1699d2e2fbcd2d5">Singleton::GetsinglenPtr</a></div><div class="ttdeci">static T * GetsinglenPtr()</div><div class="ttdef"><b>Definition:</b> Singleton.h:13</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
生成于 2018年 七月 1日 星期日 22:10:09 , 为 My Project使用  &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
